import React, { Component } from 'react';
import './Dialog.css';

/*
参数：
shadow boo 是否显示阴影
title str 标题
close_btn boo 是否显示关闭按钮
onClose fn 点击关闭按钮执行函数
*/
class Dialog extends Component {
  close () {
    this.props.onClose && this.props.onClose();
  }
  render() {
    return (
      <div>
        {
          this.props.shadow ? (
            <div className="dialog-shadow"></div>
          ) : ''
        }
        <div className="panel panel-default dialog-panel">
          <div className="panel-heading">
            <h2 className="panel-title">
              {this.props.title || '标题'}
              {this.props.close_btn ? (
                <a href="javascript:;" className="glyphicon glyphicon-remove pull-right" onClick={this.close.bind(this)}></a>
              ) : ''}
            </h2>
          </div>
          <div className="panel-body">
            {this.props.children}
          </div>
        </div>
      </div>
    );
  }

}

export default Dialog;
